package com.life.ai.server.framework.config.properties;

import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

/**
 * 系统全局参数
 * SystemProperties
 *
 * @author kylewka
 * @since 2023/10/24
 */
@Component
@ConfigurationProperties(prefix = "system")
public class SystemProperties {
    /**
     * 登录最大重试次数
     */
    public static long    loginMaxRetryCount = 5;
    /**
     * 登录锁定时长（分钟）
     */
    public static long    loginLockTime      = 1;
    /**
     * 系统后台登录验证码
     */
    public static boolean enableLoginCaptcha = false;
    /**
     * 记录登录位置信息
     */
    public static boolean saveLoginLocation  = false;

    public void setLoginMaxRetryCount(long loginMaxRetryCount) {
        SystemProperties.loginMaxRetryCount = loginMaxRetryCount;
    }

    public void setLoginLockTime(long loginLockTime) {
        SystemProperties.loginLockTime = loginLockTime;
    }

    public void setEnableLoginCaptcha(boolean enableLoginCaptcha) {
        SystemProperties.enableLoginCaptcha = enableLoginCaptcha;
    }

    public void setSaveLoginLocation(boolean saveLoginLocation) {
        SystemProperties.saveLoginLocation = saveLoginLocation;
    }

    public long getLoginMaxRetryCount() {
        return SystemProperties.loginMaxRetryCount;
    }

    public long getLoginLockTime() {
        return SystemProperties.loginLockTime;
    }

    public boolean isEnableLoginCaptcha() {
        return SystemProperties.enableLoginCaptcha;
    }

    public boolean isSaveLoginLocation() {
        return SystemProperties.saveLoginLocation;
    }
}
